package org.NooLab.itexx.app.gui.handlers;

import java.awt.Color;

import javax.swing.JFrame;

import org.NooLab.itexx.app.gui.definition.ITexxWindowGuiIntf;
import org.NooLab.itexx.app.gui.handlers.keys.KeyActionIntf;

import com.sun.jna.examples.WindowUtils;



/**
 * 
 * this class is always created in-process. It acts as a facade to WindowAppearance/2 in
 * case of keyboard events, that are arriving from the Keyhandler object
 * 
 *
 */
public class WindowToggler implements KeyActionIntf {

	WindowAppearanceIntf windowAppearance;
	ITexxWindowGuiIntf windowGui;
	private int preset;
	
	
	
	// ------------------------------------------------------------------------
	public WindowToggler(WindowAppearanceIntf windowAppearance, int preset) {
		this.windowAppearance = windowAppearance;
		if (windowAppearance!=null){
			windowGui = windowAppearance.getWindowGui() ;
		}
		this.preset = preset;
	
	}
	// ------------------------------------------------------------------------
	
	
	@Override
	public void perform(int parameter) {
	int inParam = parameter;
		if ((parameter==-1) || (parameter==-100)){
			parameter = preset; 
		}
		windowGui.getOut().print(2, "WindowToggler called with parameter value = "+parameter); 
		
		if ((inParam>=30) && (inParam<=40)){
			
		}
		if (inParam>=100){ // defined in the keyPressed event.. still & unfortunately
			windowAppearance.toggleSimpleView(parameter);
		}else{
			windowAppearance.prepareSimpleView(parameter);	
		}
		
		
	}
	
}
